<?php

namespace app\common\model;

use think\Model;
use think\Db;
/**
 * 提现模型
 */
class Tixian extends Model
{
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;

    protected $append = ['user_id_text','status_text','createtime_text'];

    public function getCreateTimeTextAttr($value, $data)
    {
        $value = $value ? $value : $data['createtime'];
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }

    public function getUserList(){
        $model = new \app\common\model\User();
        $data = $model->getUserList();
        return $data;
    }

    public function getUserIdTextAttr($value, $data)
    {
        $value = $value ? $value : $data['user_id'];
        $list = $this->getUserList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getStatusList()
    {
        return ['0' => __('未审核'),'1' => __('通过'),'2' => __('拒绝')];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : $data['status'];
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}